<template>
	<view class="my-search-container" :style="{'background-color': bgColor}">
		<view class="my-search-box"  :style="{'border-radius': radius+'px'}" @click="emitGotoSearch">
			<uni-icons type="search" size="17"></uni-icons>
			<text>搜索</text>	
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-search",
		data() {
			return {
				
			};
		},
		props: {
			bgColor: {
				type: String,
				default: "#c00000"
			},
			radius: {
				type: Number,
				default: 15
			}
		},
		methods: {
			emitGotoSearch() {
				this.$emit("gotoSearch");
			}
		}
	}
</script>

<style lang="scss">
.my-search-container {
	// background-color: #c00000;
	height: 50px;
	padding: 0 10px;
	// 让my-search-box盒子垂直居中
	display: flex;
	align-items: center;
	
	.my-search-box {
		height: 36px;
		width: 100%;
		background-color: #fff;
		// 增加组件的通用性，可以自定义search框圆角尺寸和外部空盒子的背景颜色
		// border-radius: 18px;
		display: flex;
		align-items: center;
		justify-content: center;
		
		text {
			font-size: 15px;
			margin-left: 5px;
		}
	}
}
</style>